//
//  RoadsideAssistanceShopDetailTableViewCell.m
//  JxCarios
//
//  Created by xcq on 15/1/31.
//  Copyright (c) 2015年 xiongchuanqi. All rights reserved.
//

#import "RoadsideAssistanceShopDetailTableViewCell.h"

@implementation RoadsideAssistanceShopDetailTableViewCell

- (void)awakeFromNib {
    self.shopLogo.layer.cornerRadius = 5.0f;
    self.shopLogo.layer.masksToBounds = YES;
    // Initialization code
    _tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(praiseAction)];
    [_praiseView addGestureRecognizer:_tap];
    _tap_two = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(negativeFeedbackAction)];
    [_negativeFeedbackView addGestureRecognizer:_tap_two];
}

- (void)setInfo:(NSDictionary *)info{
    if (info) {
        _info = info;
        self.praiseCount = [[_info customObjectForkey:@"GOOD_NUM"] floatValue];
         self.negativeFeedbackCount = [[_info customObjectForkey:@"ERR_NUM"] floatValue];
        [_shopLogo setImageWithURL:[NSURL URLWithString:[info customObjectForkey:@"SHOP_LOGO"]] placeholderImage:nil options:SDWebImageProgressiveDownload ];
        _shopName.text = [info objectForKey:@"SHOP_NAME"];
    }
}

- (void)setPraiseCount:(CGFloat)praiseCount{
    _praiseCount = praiseCount;
    _praiseNum.text = [NSString stringWithFormat:@"%.0f",_praiseCount];
}

- (void)setNegativeFeedbackCount:(CGFloat)negativeFeedbackCount{
    _negativeFeedbackCount = negativeFeedbackCount;
    _negativeFeedbackNum.text = [NSString stringWithFormat:@"%.0f",_negativeFeedbackCount];
}

- (void)negativeFeedbackAction {
    _negativeFeedbackCount--;
    _negativeFeedbackNum.text = [NSString stringWithFormat:@"%.0f",_negativeFeedbackCount];
}

- (void)praiseAction {
    _praiseCount++;
    _praiseNum.text = [NSString stringWithFormat:@"%.0f",_praiseCount];
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
